<template>
  <div>
    <div ref="box" class="box"></div>
  </div>
</template>

<script>
// import * as echarts from 'echarts'
// import * as echarts from 'echarts/core'
// import { RadarChart } from 'echarts/charts'
// import { CanvasRenderer } from 'echarts/renderers'

// echarts.use([RadarChart, CanvasRenderer])
export default {
  mounted () {
    this.initChart()
  },
  methods: {
    initChart () {
      const myChart = this.echarts.init(this.$refs.box)
      // console.log('Vue实例: ', this)

      const option = {
        radar: {
          // shape: 'circle',
          axisName: {
            // textStyle: {
            color: '#fff',
            backgroundColor: '#999',
            borderRadius: 3,
            padding: [3, 5]
            // }
          },
          // shape: 'circle',
          indicator: [
            { name: '工作效率', max: 100 },
            { name: '考勤', max: 100 },
            { name: '积极性', max: 100 },
            { name: '帮助同事', max: 100 },
            { name: '自主学习', max: 100 },
            { name: '正确率', max: 100 }
          ]
        },
        series: [
          {
            type: 'radar',
            data: [
              {
                value: [10, 1, 100, 5, 100, 0],
                name: '张三'
              },
              {
                value: [50, 50, 50, 50, 50, 10],
                name: '李四'
              }
            ]
          }
        ]
      }
      myChart.setOption(option)
    }
  }
}
</script>

<style lang="scss" scoped>
.box {
  width: 100%;
  height: 400px;
}
</style>
